package com.xk857.school.controller;


import com.xk857.entities.Tourism;
import com.xk857.school.req.TourismREQ;
import com.xk857.school.req.TourismUserREQ;
import com.xk857.school.service.ITourismService;
import com.xk857.util.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 组团旅游 前端控制器
 * </p>
 *
 * @author CV大魔王
 * @since 2021-05-02
 */
@Api(value = "组团旅游管理接口", tags = "组团旅游管理接口")
@RestController
@RequestMapping("/pri/tourism")
public class TourismController {


    @Autowired
    private ITourismService tourismService;

    @ApiOperation("用户发布组团信息")
    @PostMapping("/add")
    public Result addByUser(@RequestBody TourismUserREQ req) {
        return tourismService.addByUser(req);
    }

    @ApiOperation("管理员添加组团信息")
    @PostMapping
    public Result add(@RequestBody Tourism tourism) {
        return tourismService.add(tourism);
    }


    @ApiOperation("修改组团信息")
    @PutMapping
    public Result update(@RequestBody Tourism tourism) {
        return tourismService.update(tourism);
    }


    @ApiOperation("删除组团信息")
    @DeleteMapping("/{id}")
    public Result delete(@PathVariable String id) {
        return tourismService.deleteById(id);
    }
}
